<template>
	<view>
		<view class="uni-margin-wrap">
			<swiper class="swiper" circular :indicator-dots="true" :autoplay="true" :interval="2000"
				:duration="500">
				<swiper-item>
					<view class="swiper-item uni-bg-red">
						<image src="../../static/indexBG.jpg"></image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item uni-bg-green">
						<image src="../../static/222.webp"></image>
					</view>
				</swiper-item>
				<swiper-item>
					<view class="swiper-item uni-bg-blue">
						<image src="../../static/333.webp"></image>
					</view>
				</swiper-item>
			</swiper>
		</view>
	</view>
	<button @click="scanCode" class="scan">扫码点餐</button>
	<image src="../../static/11.jpg" mode=""></image>
</template>

<script setup>
	import store from '../../store/index.js'
	import * as API from "../../api/index.js"
	const Store = store()
	function scanCode(){
		uni.scanCode({
			success: (res) => {
				Store.setTable(res.result)
				API.getFoodList().then((res)=>{
					Store.foodList.push(...res.data.foodList)
					console.log(Store.foodList)
				})
				uni.switchTab({
					url:'../index/index'
				})
			}
		})
	}
</script>

<style lang="less">
	.scan{
		margin: 0 auto;
		width: 150px;
		height: 50px;
		border-radius: 20px;
		color: orange;
		border-color: orange;
		border: 1px solid;
	}
	.uni-margin-wrap {
			width: 690rpx;
			width: 100%;
		}
		.swiper {
			height: 500rpx;
		}
		.swiper-item {
			display: block;
			height: 500rpx;
			line-height: 500rpx;
			text-align: center;
		}
		.swiper-list {
			margin-top: 40rpx;
			margin-bottom: 0;
		}
		.uni-common-mt {
			margin-top: 60rpx;
			position: relative;
		}
		.info {
			position: absolute;
			right: 20rpx;
		}
		.uni-padding-wrap {
			width: 550rpx;
			padding: 0 100rpx;
		}
</style>